package org.example;

/**
 * Hello world!
 *
 */
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class App {
    public static void main(String[] args) {
        // 启动 Spring 容器（加载 XML 配置文件）
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");

        // 从容器中获取 Bean
        Product product = (Product) context.getBean("product");
        Student student = (Student) context.getBean("student");

        // 输出内容
        System.out.println(product);
        System.out.println(student);

        // 关闭容器（可选）
        ((ClassPathXmlApplicationContext) context).close();
    }
}